package com.css.fxfzypg.config.interceptor;

import com.css.fxfzypg.config.property.FxfzConfig;
import com.css.fxfzypg.web.interceptor.ApiInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author wenyugang
 * @Date 2020/4/26
 * @Version 1.0.0
 * @Description
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private ApiInterceptor apiInterceptor;

    @Autowired
    FxfzConfig fxfzConfig;
    /**
     * 远程api调用
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        //远程api
        registry.addInterceptor(apiInterceptor)
                .addPathPatterns(fxfzConfig.getApiAddPath())
                .excludePathPatterns(fxfzConfig.getApiExcludePath());
    }

}
